﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ContactPage.aspx.cs" Inherits="Main_Contact_ContactPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript">
        function NewContact() {
            var win_width = 1020
            var win_height = 750
            var loc_left = (screen.width / 2) - (win_width / 2)
            var loc_top = (screen.height / 2) - (win_height / 2)
            var url = "ContactNew.aspx"
            var name = "newContact"
            var style = "top=" + loc_top + ", left=" + loc_left +
            "toolbar=no,location=no,directories=no," +
            "status=no,menubar=no,scrollbars=yes," +
            "resizable=no,copyhistory=no,width=" + win_width +
            ",height=" + win_height
            var c_win = window.open(url, name, style);
            c_win.focus();
            return false;
        }

        function EditContact(contactID) {
            /*window.location.href = "ContactPage.aspx?action=edit&contact_id=" + contactID;*/
            var win_width = 1020
            var win_height = 750
            var loc_left = (screen.width / 2) - (win_width / 2)
            var loc_top = (screen.height / 2) - (win_height / 2)
            var url = "ContactNew.aspx?action=edit&contact_id=" + contactID;
            var name = "newContact"
            var style = "top=" + loc_top + ", left=" + loc_left +
            "toolbar=no,location=no,directories=no," +
            "status=no,menubar=no,scrollbars=yes," +
            "resizable=no,copyhistory=no,width=" + win_width +
            ",height=" + win_height
            var c_win = window.open(url, name, style);
            c_win.focus();
            return false;
        }
        function DeleteContact(contactID) {
            window.location.href = "ContactPage.aspx?action=delete&contact_id=" + contactID;
        }
    </script>
    <style type="text/css">
    #Header
    {
        margin:0; padding:0;
        height:60px;
        background-color:white;
    }
    #Navigation
    {
        margin:0; padding:0;
        height:20px;   
        background-image:url("../images/bg_copy.gif");
        background-repeat:repeat-x;
        border-bottom:solid 2px #cdc9c9;
        overflow:auto;
    }
    #Navigation table tr td
    {
        margin:0; padding:0;
        font-family:arial;
        font-size:12px;
        font-weight:bold;
        text-align:center;
        padding:3px;
        width:80px;
        border-bottom:solid 2px #cdc9c9;
        border-right:solid 2px #cdc9c9;
    }
    #Navigation table tr td a
    {
        text-decoration: none;
        color:black;
    }
    #Header2
    {
        margin:0;padding:0;
        height:55px;
        overflow:auto;
        border-bottom:solid 1px black;
    }
    #Body
    {
        margin:0;padding:0;
        height:145px;
        overflow:auto;
        border-bottom:solid 1px black;
    }
    .grdView
    {
        font-family:Arial;
        font-size:12px;
        margin-left:30px;
    }
    #Search
    {
        margin:0;padding:0;
        height:150px;
        background-color:white;
        padding:10px 0px 0px 40px;
        font-family:Arial;
        font-size:12px;
    }
    #Search table.searchTable
    {
        padding:3px 3px 3px 3px;
        border:solid 1px black;
    }
    #Search table
    {
        padding:3px 3px 3px 3px;
    }
    .colorHeading
    {
        color:red;
        font-weight:bold;
    }
    .TextBox
    {
        background-color:#ffe4b5;
    }
    .headerDisplay
    {
        text-align:left;
    }
    .editButton
    {
        cursor:pointer;
        font-family:Arial;
        font-size:12px;
        color:Blue;
        text-decoration:underline;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="Header">
        <img src="../images/contacts_header.gif"/>
    </div>
    <div id="Navigation">
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td><a href ="#">contacts view</a></td>
                <td><a href ="" onclick="javascript:NewContact();">new contact</a></td>
            </tr>
        </table>
    </div>
    <div id="Header2">
        &nbsp;
    </div>
    <div id="Body">
        <asp:GridView ID="grdContacts" runat="server" AutoGenerateColumns="false" 
            AllowPaging="true" AllowSorting="true" PageSize="5" 
            onpageindexchanging="grdContacts_PageIndexChanging" 
            onsorting="grdContacts_Sorting" BorderStyle="None" BorderColor="white" 
            CssClass="grdView" onrowdatabound="grdContacts_RowDataBound">
        <Columns>
        <asp:BoundField DataField="completeName" ItemStyle-Width="250px" HeaderStyle-CssClass="headerDisplay" ShowHeader="true" HeaderText="Name" SortExpression="completeName" />
        <asp:BoundField DataField="completeAddress" ItemStyle-Width="250px" HeaderStyle-CssClass="headerDisplay" ShowHeader="true" HeaderText="Address" SortExpression="completeAddress" />
        <asp:BoundField DataField="email_address" ItemStyle-Width="200px" HeaderStyle-CssClass="headerDisplay" ShowHeader="true" HeaderText="Email-Address" SortExpression="email_address" />
        <asp:BoundField DataField="company_name" ItemStyle-Width="200px" HeaderStyle-CssClass="headerDisplay" ShowHeader="true" HeaderText="Company Name" SortExpression="company_name" />
        <asp:TemplateField>
             <ItemTemplate>
                 <asp:Label ID="lblEdit" runat="server" Text="Label" CssClass="editButton">Edit</asp:Label>
             </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
             <ItemTemplate>
                 <asp:Label ID="lblDelete" runat="server" Text="Label" CssClass="editButton">Delete</asp:Label>
             </ItemTemplate>
        </asp:TemplateField>
        </Columns>
        </asp:GridView>
    </div>
    <div id="Search">
        <table border="0" cellpadding="0" cellspacing="0" class="searchTable">
            <tr style="border-bottom:solid 1px black">
                <td colspan="2" class="colorHeading">Search Contacts</td>
            </tr>
            <tr>
                <td style="width:120px; height:30px;">Search For:</td>
                <td style="width:200px;">
                    <asp:TextBox ID="txtSearchFor" runat="server" Width="180px" CssClass="TextBox"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td style="width:120px; height:30px;">Search In:</td>
                <td style="width:200px;">
                    <asp:DropDownList ID="ddownFields" runat="server" Width="150px" CssClass="TextBox">
                        <asp:ListItem Value="lstAllFields">All Name Fields</asp:ListItem>
                        <asp:ListItem Value="lstName">Name</asp:ListItem>
                        <asp:ListItem Value="lstAddress">Address</asp:ListItem>
                        <asp:ListItem Value="lstEmailAddress">EmailAddress</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <asp:Button ID="btnSearch" runat="server" Text="Search" 
                        onclick="btnSearch_Click"/>
                </td>
            </tr>
        </table>
    </div>
    
    </form>
</body>
</html>
